import java.io.PrintWriter;
import java.util.Random;

public class FakeData {
	static int COLS = 4;
	static int ROWS = 4 * 1000 * 1000;
	static double[][] DATA;
	static double[] LABEL;
	static double[] FORMULA;
	static Random RANDOM;

	public static void main(String[] args) {
		fakeData();
		writeData();
	}

	static void fakeData() {
		DATA = new double[ROWS][COLS];
		LABEL = new double[ROWS];
		FORMULA = new double[ROWS];
		RANDOM = new Random(1);

		FORMULA[0] = 1;
		for (int c = 1; c < COLS; c++) {
			FORMULA[c] = ((double) (int) (RANDOM.nextGaussian() * 100)) / 600;
		}

		for (int r = 0; r < LABEL.length; r++) {
			double label = 70;
			DATA[r][0] = label;

			for (int c = 1; c < COLS; c++) {
				double value = (double) RANDOM.nextInt(100);
				DATA[r][c] = value;
				label += FORMULA[c] * value;
			}

			LABEL[r] = label;
		}

		Data.DATA = DATA;
		Data.LABEL = LABEL;
		Data.ROWS = ROWS;
		Data.COLS = COLS;
	}

	static void printData() {
		for (int r = 0; r < LABEL.length; r++) {
			for (int c = 0; c < COLS; c++) {
				System.out.printf("%5.0f ", DATA[r][c]);
			}

			System.out.printf("  %+5.2f\n", LABEL[r]);
		}

		for (int c = 0; c < COLS; c++) {
			System.out.printf("%5.2f ", FORMULA[c]);
		}

	}

	static void writeData() {
		PrintWriter pw = arff();

		for (int r = 0; r < LABEL.length; r++) {
			for (int c = 0; c < COLS; c++) {
				pw.printf("%.0f,", DATA[r][c]);
			}
			pw.printf("%.0f\n", LABEL[r]);
		}

		pw.close();
	}

	static PrintWriter arff() {
		String s = "";
		for (int c = 0; c < COLS; c++) {
			s += String.format("%.2f", FORMULA[c]);
			s += "_";
		}
		s += "__";

		try {
			PrintWriter pw = new PrintWriter(s + COLS + "_fake.arff");
			pw.println("@relation " + s);
			for (int c = 0; c < COLS; c++) {
				pw.printf("@attribute a%d_%.2f numeric\n", c, FORMULA[c]);
			}
			pw.printf("@attribute label numeric\n");

			pw.println("@data");
			pw.flush();

			return pw;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
